<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!--
        1、通过new Object()直接创建对象
        2、通过 {}形式创建对象
    -->
    <script>
        // var person = new Object();
        // person.name = "gwc";
        // person.show = function(food){
        //     console.log(this.name+"喜欢吃"+food);
        // }
        // person.show("香蕉");
        var person = {
            "name": "zyh",
            "show": function(food){
                console.log(this.name+"喜欢吃"+food);
            }
        }
        person.show("梨");

    </script>
</head>
<body>
    
</body>
</html>